package com.testfileupload.uploadimg.design.visitor;

import java.util.ArrayList;
import java.util.List;

public class Client {
    public static void main(String[] args) {
        IVisitor visitor = new Visitor();
        for (Employee emp : mockEmployee()) {
//            emp.report();
            emp.accept(visitor);
        }
        System.out.println("工资总和" + visitor.getTotalSalary());
    }

    private static List<Employee> mockEmployee() {
        List<Employee> list = new ArrayList<>();
        //产生张三
        CommonEmployee zhangsan = new CommonEmployee();
        zhangsan.setName("张三");
        zhangsan.setSalary(100);
        zhangsan.setSex(Employee.MALE);
        zhangsan.setJob("码农");
        //产生李四
        CommonEmployee lisi = new CommonEmployee();
        lisi.setName("李四");
        lisi.setSex(Employee.MALE);
        lisi.setSalary(50);
        lisi.setJob("美工");
        //产生经理
        Manager wangwu = new Manager();
        wangwu.setPerformance("经理");
        wangwu.setSalary(2000);
        wangwu.setName("王五");
        wangwu.setSex(Employee.FEMALE);
        list.add(zhangsan);
        list.add(lisi);
        list.add(wangwu);

        return list;
    }
}
